package com.iotechn.unimall.data.dto.warehouse;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelTarget;
import com.iotechn.unimall.data.dto.SuperDTO;
import lombok.Data;

import java.io.Serializable;
import java.text.DecimalFormat;
import java.util.Date;


@ExcelTarget("salesSendOrderGoodsDTO")
@Data
public class SalesSendOrderGoodsDTO extends SuperDTO implements Serializable {
    public String goodsImg;
    public Long goodsId;
    @Excel(name = "条码", width = 20d)
    public String goodsBarCode;
    @Excel(name = "单位")
    public String goodsUnit;
    @Excel(name = "单号", width = 20d)
    private String orderNo;
    @Excel(name = "名称")
    private String spuName;
    @Excel(name = "规格")
    private String skuName;
    @Excel(name = "数量")
    private Float sendGoodsStock;
    private Long skuId;
    private Long warehouseId;
    @Excel(name = "单价")
    private Float sendGoodsPrice;
    @Excel(name = "单品总价")
    private Float sendGoodsAllPrice;
    @Excel(name = "总价")
    private Float goodsTotalPrice;
    private Long sendGoodsTax;
    private Long sendOrderId;
    private Long adminId;
    private Date gmtUpdate;
    private String goodsName;
    private String img;
    private String unit;
    //仓库已有库存
    private Float warehouseSkuNum;

    private String barCode;
    //平均成本
    private Float averPrice;

    @Excel(name = "状态", replace = {"待出库_0", "已出库_1", "驳回_2", " _ "})
    private Integer warehouseOrderState;
    @Excel(name = "仓库")
    private String warehouseName;
    @Excel(name = "门店")
    private String storeName;

    @Excel(name = "制单日期", databaseFormat = "yyyyMMddHHmmss", format = "yyyy-MM-dd HH:mm:ss")
    private Date gmtCreate;

    public Float getGoodsTotalPrice() {
        if (this.sendGoodsStock == null || this.sendGoodsPrice == null) {
            return 0F;
        }
        DecimalFormat decimalFormat = new DecimalFormat(".00");
        String total = decimalFormat.format(this.sendGoodsStock * this.sendGoodsPrice);
        return Float.valueOf(total);
    }
}
